package com.itcast.donkey.adapters;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.itcast.donkey.R;

/**
 * Created by lanouhn on 16/9/20.
 */
public class SeachSeasonsAdapter extends RecyclerView.Adapter<SeachSeasonsAdapter.MyHolder> {
    private Context context;
    private String[] monthName;

    public SeachSeasonsAdapter(Context context, String[] monthName) {
        this.context = context;
        this.monthName = monthName;
    }

    @Override
    public MyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_seach_seasons, null);
        MyHolder holder = new MyHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(MyHolder holder, int position) {

        holder.tv_seasons.setText(monthName[position]);
    }

    @Override
    public int getItemCount() {
        return monthName.length;
    }

    public class MyHolder extends RecyclerView.ViewHolder {
        private TextView tv_seasons;

        public MyHolder(View itemView) {
            super(itemView);
            tv_seasons = (TextView) itemView.findViewById(R.id.tv_seasons);
        }
    }
}
